﻿using System;
using System.IO;
using System.Text;

namespace _1文件流
{
    class Program
    {
        static void Main(string[] args)
        {
            using (FileStream file1 = new FileStream("./test.txt", FileMode.OpenOrCreate))
            {


                Console.WriteLine("Hello World!");
                string str1 = "彭定俊";
                byte[] arr1 = Encoding.UTF8.GetBytes(str1);
                file1.Write(arr1, 0, arr1.Length);
                //file1.Close();
                //file1.Dispose();4
                string str2 = @"C:\Users\86198\Desktop\333影视-《我家大师兄脑子有坑第二季第13集》高清完整版全集免费播放『极速不卡』 - 333影视-影视之家视频解析系统_2170920276.mp4";
                string str3 = @"C:\Users\86198\Desktop\11.mp4";
                FileCopy(str2, str3);
            }
            void FileCopy(string source,string des)
            {
                using (FileStream file1 = new FileStream(source, FileMode.Open,FileAccess.Read))
                {
                    using (FileStream file2 = new FileStream(des,FileMode.OpenOrCreate,FileAccess.Write))
                    {
                        byte[] date1 = new byte[1024 * 1024 * 5];
                        while(true)
                        {
                            int r=file1.Read(date1, 0, date1.Length);
                            
                            if(r==0)
                            {
                                break;
                            }
                            file2.Write(date1, 0, date1.Length);
                        }
                    }

                }
            }
        }
    }
}
